﻿Imports System.ComponentModel.DataAnnotations
Imports System.Collections.ObjectModel

Public Class PatientVisit
    Public Property visitID() As Short
    <Required()> _
    Public Overloads Property patientID() As Long
    <Required()> _
    Public Property visitDataTime() As Date
    <Required()> _
    Public Property consultingDoc() As Integer
    <Required()> _
    Public Property consultationRoom() As Integer? = Nothing
    <Required()> _
    Public Property visitStatus() As Integer? = Nothing
    <Required()> _
    Public Property compalinedComplaints() As Integer
    <Required()> _
    Public Property followUpID() As Integer? = Nothing

    Public Property visitNote() As String

    Public ProblemList As ObservableCollection(Of PatientProblem)
    Public findingList As ObservableCollection(Of PatientExamFinding)
    Public DiagnosisList As ObservableCollection(Of PatientDiagnosis)
    Public TreatmentList As ObservableCollection(Of PatientPrescription)

#Region "NHibernate Composite Key Requirements"
    Public Overrides Function Equals(ByVal obj As Object) As Boolean
        If obj Is Nothing Then Return False
        Dim t = TryCast(obj, PatientVisit)
        If t Is Nothing Then Return False
        If patientID = t.patientID AndAlso visitID = t.visitID Then
            Return True
        End If

        Return False
    End Function
    Public Overrides Function GetHashCode() As Integer
        Dim hash As Integer = 13
        hash += patientID.GetHashCode()
        hash += visitID.GetHashCode()

        Return hash
    End Function
#End Region
End Class
